package Operation;

import Book.Book;
import Book.Booklist;

import java.util.Scanner;

public class selectBook implements Ioperation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("查找书籍");
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入你要查找的书");
        String name=sc.nextLine();
        int num=booklist.getSizeBook();
        int index=0;
        for (int j = 0; j <num ; j++) {
            Book book=booklist.getBook(j);
            if(book.getBookName().equals(name)){
                System.out.println("找到了你要的书");
                System.out.println(book);
                index=1;
                break;
            }
        }
        if(index==0){
            System.out.println("没有找到你查找的书");
        }
    }
}
